package com.yanqu.road.server.cmd.rank;

import com.yanqu.road.pb.rank.RankProto;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.ServerGroupMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_GROUP_RANK_TOP, desc = "获取分组榜首数据")
public class GetGroupRankTopCmd extends AbstractCommand {

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		return true;
	}

	@Override
	public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
		int groupId = ServerGroupMgr.getGroupIdByServerId(GameServer.getInstance().getServerId());
		RankProto.CrossGroupRankTopReqMsg.Builder req = RankProto.CrossGroupRankTopReqMsg.newBuilder();
		req.setGroupId(groupId);
		player.sendPacket(CrossProtocol.C_CROSS_GROUP_RANK_TOP, req);
	}

	@Override
	public void sendData(GamePlayer player) {
	/*	RankProto.RankTopOneRespMsg.Builder respMsg = RankProto.RankTopOneRespMsg.newBuilder();
		//赚速榜首
		RankProto.RankListMsg.Builder rankListMsg = CrossDataMgr.getCrossGroupRankMsg(eRankType.EarnSpeed.getValue(), eBigRankType.Normal.getValue());
		if(null != rankListMsg && rankListMsg.getRankListCount() > 0){
			respMsg.setEarnSpeedRankTop(rankListMsg.getRankList(0));
		}
		//实力榜首
		rankListMsg = CrossDataMgr.getCrossGroupRankMsg(eRankType.PatronsAbility.getValue(), eBigRankType.Normal.getValue());
		if(null != rankListMsg && rankListMsg.getRankListCount() > 0){
			respMsg.setAbilityRankTop(rankListMsg.getRankList(0));
		}
		//亲密度榜首
		rankListMsg = CrossDataMgr.getCrossGroupRankMsg(eRankType.BeautyIntimacy.getValue(), eBigRankType.Normal.getValue());
		if(null != rankListMsg && rankListMsg.getRankListCount() > 0){
			respMsg.setIntimacyRankTop(rankListMsg.getRankList(0));
		}
		//商会榜首
		RankProto.UnionRankListMsg.Builder unionListMsg = CrossDataMgr.getCrossGroupUnionRankMsg();
		if(null != unionListMsg && unionListMsg.getRankListCount() > 0){
			respMsg.setUnionRankTop(unionListMsg.getRankList(0));
		}

		player.sendChannelPacket(Protocol.U_GROUP_RANK_TOP, respMsg);*/
	}
}
